/* 
		SHOW RELATED POST
		fist you must include this file
		To Display this script search    <div class='post-footer'> copy this code below post footer divider.
		--------------
		<b:if cond='data:blog.pageType == "item"'>
             <!-- Related Posts with Thumbnails Code Start-->
                      <div class='lbox-gallery'>
                        <b:loop values='data:post.labels' var='label'>
                          <b:if cond='data:label.isLast != "true"'>
                          </b:if>
                          <script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&amp;callback=related_results_labels_thumbs&amp;max-results=6"' type='text/javascript'/>
                        </b:loop>
                        <script type='text/javascript'>
                          removeRelatedDuplicates_thumbs();
                          printRelatedLabels_thumbs("<data:post.url/>");
                        </script>
                      </div>
                  <div style='clear:both'/>
         <!-- End Related Posts with Thumbnails Code Start-->
		--------------
*/
// Optional show 
		var defaultnoimage="http://3.bp.blogspot.com/-ghlzgmOFzJM/UfGWCZ5Of1I/AAAAAAAABH8/TCMiZY7aPYM/s1600/Camera-icon.png";
		var maxresults=4;
		var splittercolor="#DDDDDD";
        var relatedpoststitle="You Might Also Like :";
//function related post
		var relatedTitles = new Array();
		var relatedTitlesNum = 0;
		var relatedUrls = new Array();
		var thumburl = new Array();
		var ImageSize = "320-p";
		function related_results_labels_thumbs(json) {
		for (var i = 0; i < json.feed.entry.length; i++) {
		var entry = json.feed.entry[i];
		relatedTitles[relatedTitlesNum] = entry.title.$t;
		try 
		{
			thumburl[relatedTitlesNum]=f[z].media$thumbnail.url.replace(/\/s[0-9]+\-c/g, "/" + d.options.ImageSize);
		}


		catch (error){

		s=entry.content.$t;a=s.indexOf("<img");b=s.indexOf("src=\"",a);c=s.indexOf("\"",b+5);d=s.substr(b+5,c-b-5);
		if((a!=-1)&&(b!=-1)&&(c!=-1)&&(d!=""))
		{thumburl[relatedTitlesNum]=d;} else {if(typeof(defaultnoimage) !== 'undefined') thumburl[relatedTitlesNum]=defaultnoimage; else thumburl[relatedTitlesNum]="http://3.bp.blogspot.com/-PpjfsStySz0/UF91FE7rxfI/AAAAAAAACl8/092MmUHSFQ0/s1600/no_image.jpg";}

		}

		if(relatedTitles[relatedTitlesNum].length>35) relatedTitles[relatedTitlesNum]=relatedTitles[relatedTitlesNum].substring(0, 35)+"...";
		for (var k = 0; k < entry.link.length; k++) {
		if (entry.link[k].rel == 'alternate') {
		relatedUrls[relatedTitlesNum] = entry.link[k].href;
		relatedTitlesNum++;


		}
		}
		}
		}
		function removeRelatedDuplicates_thumbs() {
		var tmp = new Array(0);
		var tmp2 = new Array(0);
		var tmp3 = new Array(0);
		for(var i = 0; i < relatedUrls.length; i++) {
		if(!contains_thumbs(tmp, relatedUrls[i])) 
		{
		tmp.length += 1;
		tmp[tmp.length - 1] = relatedUrls[i];
		tmp2.length += 1;
		tmp3.length += 1;
		tmp2[tmp2.length - 1] = relatedTitles[i];
		tmp3[tmp3.length - 1] = thumburl[i];
		}
		}
		relatedTitles = tmp2;
		relatedUrls = tmp;
		thumburl=tmp3;


		}

		function contains_thumbs(a, e) {
		for(var j = 0; j < a.length; j++) if (a[j]==e) return true;
		return false;
		}


		function printRelatedLabels_thumbs(current) {
		var splitbarcolor;
		if(typeof(splittercolor) !== 'undefined') splitbarcolor=splittercolor; else splitbarcolor="#DDDDDD";
		for(var i = 0; i < relatedUrls.length; i++)
		{
		if((relatedUrls[i]==current)||(!relatedTitles[i]))
		{
		relatedUrls.splice(i,1);
		relatedTitles.splice(i,1);
		thumburl.splice(i,1);
		i--;
		}
		}


		var r = Math.floor((relatedTitles.length - 1) * Math.random());
		var i = 0;


		while (i < relatedTitles.length && i < 20 && i<maxresults) {
          document.write('<div class="content-list col-md-3 col-sm-4 col-xs-6"><div>');
          document.write('<div class="mint-right-list"><div class="overlay"><a  href="' + relatedUrls[r] + '"><span><i class="fa fa-plus"></i> More</span></a></div><img style="width:100%;" src="'+thumburl[r]+'"/></div><div class="mint-right-desc"><h5 class="mint-title"><a href="' + relatedUrls[r] + '">'+relatedTitles[r] +'</a></h5><div class="meta-date"><a href="#"><i class="fa fa-clock-o"></i>&nbsp;&nbsp;Published</a></div></div></div></div>');

		i++;


		if (r < relatedTitles.length - 1) {
		r++;
		} else {
		r = 0;
		}

		}

		relatedUrls.splice(0,relatedUrls.length);
		thumburl.splice(0,thumburl.length);
		relatedTitles.splice(0,relatedTitles.length);

}
